import os
# find ./train/ -type f | awk '{print substr($0,length($0)-4,1)}' | sort | uniq > label.uniq
#
# #总共56个label，没有0,o,O,1,l,L(本来是64个的，这几个不方便区分)
#
# find ./train/ -type f | awk '{print $0" "substr($0,length($0)-4,1)}' | cut -f3 -d'/' > train_tmp.txt
#
# awk -F' ' 'BEGIN{id=0}NR==FNR{a[$1]=id;id+=1}NR>FNR{print $1,a[$2]}' label.uniq train_tmp.txt > train.txt
#
# find ./test/ -type f | awk '{print $0" "substr($0,length($0)-4,1)}' | cut -f3 -d'/' > test_tmp.txt
#
# awk -F' ' 'BEGIN{id=0}NR==FNR{a[$1]=id;id+=1}NR>FNR{print $1,a[$2]}' label.uniq test_tmp.txt > test.txt
# find ./train/ -type f | awk '{print substr($0,length($0)-4,1)}' | sort | uniq > label.uniq
# find ./test/ -type f | awk '{print $0" "substr($0,length($0)-4,1)}' | cut -f4 -d '/' > test_tmp.txt

# build/tools/convert_imageset --resize_height=26 --resize_width=22 ./train ./train.txt ./train_lmdb
#
# build/tools/convert_imageset --resize_height=26 --resize_width=22 ./test ./test.txt ./test_lmdb
#lmdb格式转换
#convert_imageset --resize_height=26 --resize_width=22 ./train/ ./train.txt ./train_lmdb
#convert_imageset --resize_height=26 --resize_width=22 ./test/ ./test.txt ./test_lmdb


#均值计算
# mean.binaryproto是均值文件，为加快计算的效率和训练的模型准确率而设计的，也通过caffe自带的工具compute_image_mean 来实现，数据集就采用train_lmdb就可以。
# compute_image_mean ./train_lmdb ./mean.binaryproto

#预测
# ./classification /Users/rogerluo/Desktop/pyopnecv/caffedemo/verifycode/Deploy/deploy.prototxt /Users/rogerluo/Desktop/pyopnecv/caffedemo/verifycode/verify_code_iter_10000.caffemodel  /Users/rogerluo/Desktop/pyopnecv/caffedemo/verifycode/mean.binaryproto /Users/rogerluo/Desktop/pyopnecv/caffedemo/verifycode/Synset/synset_words.txt /Users/rogerluo/Desktop/pyopnecv/caffedemo/verifycode/Pic/1001-2-t.jpg



